package workspace;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.Semaphore;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Description
 * @Author yangshunjie
 * @Date 2021/9/16
 */
public class test2 {
    public String intToRoman (int num) {
        // write code here
        int[] values = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
        String[] sym = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};

        StringBuffer s = new StringBuffer();
        for(int i = 0;i<values.length&&num>=0;i++){
            while(values[i]<=num){
                num-=values[i];
                s.append(sym[i]);
            }
        }
        return s.toString();


    }
}
